package com.ruoyi.system.outto.game.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.GlobalException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.system.model.domain.AccountInfo;
import com.ruoyi.system.model.domain.InfoImg;
import com.ruoyi.system.model.domain.SalePartner;
import com.ruoyi.system.model.mapper.AccountInfoMapper;
import com.ruoyi.system.model.mapper.InfoImgMapper;
import com.ruoyi.system.outto.core.LCConstant;
import com.ruoyi.system.outto.core.OutUrlConstant;
import com.ruoyi.system.outto.game.SBOAPI;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;

/**
 * @author lz
 * @version 1.0
 * @date 2022/6/5 16:19
 */
@Slf4j
@Service
public class SBAPIImpl implements SBOAPI {

    @Resource
    private InfoImgMapper infoImgMapper;
    @Value("${desc.title}")
    private String descTitle;
    private SalePartner salePartner;

    @Resource
    private AccountInfoMapper accountInfoMapper;

    @Autowired
    private RedisCache redisCache;

    @Override
    public AjaxResult addGame(AccountInfo accountInfo, Long userId, SalePartner salePartner) {
        String PATH = "/api/goods/UserGoods/addPost";
        this.salePartner = salePartner;
        Map<String, Object> result = new HashMap<>();
        Map<String, Object> params = params(accountInfo, userId);
        log.info("少伯添加接口请求参数={}", JSONObject.toJSONString(params));
        String response = null;
        try {
            String url = OutUrlConstant.SBO + PATH;
            response = HttpUtils.sendPost(OutUrlConstant.SBO + PATH, JSON.toJSONString(params), getHeader(salePartner));
        } catch (IOException e) {
            e.printStackTrace();
            throw new GlobalException("接口异常");
        }
        log.info("少伯添加接口返回参数={}", response);
        JSONObject resultJson = JSONObject.parseObject(response);
        if (!"1".equals(resultJson.getString("code"))) {
            result.put("code", 500);
        } else {
            result.put("code", 200);
            String data = resultJson.getString("data");
            JSONObject jsonObject = JSON.parseObject(data);
            String item = jsonObject.getString("item");
            JSONObject itemJson = JSON.parseObject(item);
            String id = itemJson.getString("id");
            AccountInfo info = accountInfoMapper.selectAccountInfoById(accountInfo.getId());
            info.setSboid(id);
            accountInfoMapper.updateAccountInfo(info);
        }

        result.put("req", JSONObject.toJSONString(params));
        result.put("res", response);
        result.put("msg", resultJson.getString("msg"));

        return AjaxResult.success(result);
    }

    @Override
    public AjaxResult editGame(AccountInfo accountInfo, Long userId, SalePartner salePartner) {

        Map<String, Object> params = new HashMap<>();


        String PATH = "/api/goods/UserGoods/editPost";

        params.put("id", accountInfo.getSboid());
        params.put("price", accountInfo.getPrice());
        params.put("quantity", "1");
        Map<String, Object> result = new HashMap<>();

        log.info("少伯改价接口请求参数={}", JSONObject.toJSONString(params));
        String response = "";
        try {
            response = HttpUtils.sendPost(OutUrlConstant.SBO + PATH, JSONObject.toJSONString(params), getHeader(salePartner));
        } catch (IOException e) {
            e.printStackTrace();
            throw new GlobalException("接口异常");
        }
        log.info("少伯改价接口返回参数={}", response);
        JSONObject resultJson = JSONObject.parseObject(response);
        if (!"1".equals(resultJson.getString("code"))) {
            result.put("code", 500);
        } else {
            result.put("code", 200);
        }

        result.put("req", JSONObject.toJSONString(params));
        result.put("res", response);
        result.put("msg", resultJson.getString("msg"));
        return AjaxResult.success(result);
    }


    private Map<String, Object> params(AccountInfo accountInfo, Long userId) {

        Map<String, Object> params = new HashMap<>();

        params.put("delivery_type", "1");
        params.put("quantity", "0");
        Integer[] timeArr = {0, 24};
        params.put("trading_time", timeArr);
        params.put("bright_spot", accountInfo.getLevel() + "|皮肤数量 " + accountInfo.getSkins() + "|英雄数量 " + accountInfo.getHeroes());
        params.put("price", accountInfo.getPrice());
        params.put("title", "xyr" + accountInfo.getId() + "|" + accountInfo.getDes());
        params.put("description", "xyr" + accountInfo.getId() + "|" + accountInfo.getDes());


        InfoImg infoImg = new InfoImg();
        infoImg.setInfoId(accountInfo.getId());
        infoImg.setType(Constants.STR_1);
        List<InfoImg> infoImgs = infoImgMapper.selectInfoImgList(infoImg);
        List<String> imgs = new ArrayList<>();

        if (!CollectionUtils.isEmpty(infoImgs)) {
            imgs = infoImgs.stream().map(im -> im.getImgUrl()).collect(Collectors.toList());
        } else {
            imgs.add(LCConstant.defaultImg);
        }
        String[] array1 = imgs.toArray(new String[imgs.size()]);
        params.put("image", array1);

        params.put("f1", "我是号主");
        params.put("f2", "无防沉迷");

        String[] nobLeve = {"V1", "V2", "V3", "V4", "V5", "V6", "V7", "V8", "V9", "V10"};

        String nn = null;
        for (String s : nobLeve) {
            if (accountInfo.getDes().contains(s)) {
                nn = s;
            }
        }

        if (StringUtils.isNotEmpty(nn)) {
            params.put("f4", nn);
        } else {
            params.put("f4", "无");
        }

        if (Arrays.asList(LCConstant.haveTwoList).contains(accountInfo.getLevel())) {
            params.put("f5", "是");
        } else {
            params.put("f5", "无");
        }

        if (Objects.equals("王者荣耀", accountInfo.getType())) {

            if (Objects.equals("安卓Q", accountInfo.getRegional())) {
                params.put("game_id", "70582");
            }
            if (Objects.equals("安卓WX", accountInfo.getRegional())) {
                params.put("game_id", "71058");
            }
            if (Objects.equals("苹果Q", accountInfo.getRegional())) {
                params.put("game_id", "71402");
            }
            if (Objects.equals("苹果WX", accountInfo.getRegional())) {
                params.put("game_id", "71536");
            }

            params.put("type", "317");

            params.put("f6", accountInfo.getHeroes());
            params.put("f7", accountInfo.getSkins());
            params.put("f8", "");
            params.put("f9", "");
            params.put("f10", "");
            params.put("f11", "");
            params.put("f12", "");
            params.put("f13", "");
            params.put("f14", "");
            params.put("f15", "");
            params.put("f16", accountInfo.getCampId());

        }
        if (Objects.equals("永劫无间", accountInfo.getType())) {

            params.put("bright_spot", "");
            params.put("type", "387");

            if (Objects.equals("Steam", accountInfo.getRegional())) {
                params.put("game_id", "92477");
            }
            if (Objects.equals("网易", accountInfo.getRegional())) {
                params.put("game_id", "92475");
            }

            params.put("f1", "手机账号");
            params.put("f2", accountInfo.getHeroes());
            params.put("f3", accountInfo.getSkins());
            params.put("f4", "");
            params.put("f5", "");
            params.put("f6", "");
            params.put("f7", "");
            params.put("f8", "");
            params.put("f9", "");
            params.put("f10", "");
            params.put("f11", "");
            params.put("f12", "");
            params.put("f13", "");
            params.put("f14", "");
            params.put("f15", "");
            params.put("f16", "");
            params.put("f17", "");
            params.put("f18", "");
            params.put("f19", "");
            params.put("f20", "");
        }
        if (Objects.equals("QQ飞车手游", accountInfo.getType())) {

            params.put("bright_spot", "");
            params.put("type", "235");

            if (Objects.equals("安卓Q", accountInfo.getRegional())) {
                params.put("game_id", "56763");
            }
            if (Objects.equals("安卓WX", accountInfo.getRegional())) {
                params.put("game_id", "56870");
            }
            if (Objects.equals("苹果Q", accountInfo.getRegional())) {
                params.put("game_id", "95475");
            }
            if (Objects.equals("苹果WX", accountInfo.getRegional())) {
                params.put("game_id", "95476");
            }

            params.put("f1", "");
            params.put("f2", "");
            params.put("f3", "");
            params.put("f4", "");
            params.put("f5", "");
            params.put("f6", "");
            params.put("f7", "");
            params.put("f8", "");
            params.put("f9", "");
            params.put("f10", "");
            params.put("f11", "");
            params.put("f12", "");
            params.put("f13", "");
            params.put("f14", "");
            params.put("f15", "");
            params.put("f16", "");
            params.put("f17", "");
            params.put("f18", "");
            params.put("f19", "");
            params.put("f20", "");
        }
        if (Objects.equals("光遇", accountInfo.getType())) {

            params.put("bright_spot", "");
            params.put("type", "87");

            if (Objects.equals("安卓网易邮箱", accountInfo.getRegional())) {
                params.put("game_id", "22272");
            }
            if (Objects.equals("小米渠道服", accountInfo.getRegional())) {
                params.put("game_id", "22293");
            }
            if (Objects.equals("VIVO渠道服", accountInfo.getRegional())) {
                params.put("game_id", "22290");
            }
            if (Objects.equals("OPPO渠道服", accountInfo.getRegional())) {
                params.put("game_id", "22287");
            }
            if (Objects.equals("华为渠道服", accountInfo.getRegional())) {
                params.put("game_id", "22284");
            }
            if (Objects.equals("苹果网易邮箱", accountInfo.getRegional())) {
                params.put("game_id", "22275");
            }

            params.put("f1", "手机账号");
            params.put("f2", "");
            params.put("f3", "");
            params.put("f4", "");
            params.put("f5", "");
            params.put("f6", "原号主");
            params.put("f7", "");
            params.put("f8", "");
            params.put("f9", "");
            params.put("f10", "");
            params.put("f11", "");
            params.put("f12", "");
            params.put("f13", "");
            params.put("f14", "");
            params.put("f15", "");
            params.put("f16", "");
            params.put("f17", "");
            params.put("f18", "");
            params.put("f19", "");
            params.put("f20", "");
        }
        if (Objects.equals("火影忍者", accountInfo.getType())) {

            params.put("bright_spot", "");
            params.put("type", "100");

            if (Objects.equals("安卓Q", accountInfo.getRegional())) {
                params.put("game_id", "25595");
            }
            if (Objects.equals("安卓WX", accountInfo.getRegional())) {
                params.put("game_id", "26717");
            }
            if (Objects.equals("苹果Q", accountInfo.getRegional())) {
                params.put("game_id", "25597");
            }
            if (Objects.equals("苹果WX", accountInfo.getRegional())) {
                params.put("game_id", "26719");
            }

            params.put("f1", "无防沉迷");
            params.put("f2", "");
            params.put("f3", "");
            params.put("f4", "");
            params.put("f5", "");
            params.put("f6", "");
            params.put("f7", "");
            params.put("f8", "");
            params.put("f9", "");
            params.put("f10", "");
            params.put("f11", "");
            params.put("f12", "");
            params.put("f13", "");
            params.put("f14", "");
            params.put("f15", "");
            params.put("f16", "");
            params.put("f17", "");
            params.put("f18", "");
            params.put("f19", "");
            params.put("f20", "");
        }
        if (Objects.equals("CF手游", accountInfo.getType())) {

            params.put("bright_spot", "");
            params.put("type", "26");

            if (Objects.equals("安卓Q", accountInfo.getRegional())) {
                params.put("game_id", "4870");
                params.put("f1", "安卓");
            }
            if (Objects.equals("安卓WX", accountInfo.getRegional())) {
                params.put("game_id", "4875");
                params.put("f1", "安卓");
            }
            if (Objects.equals("苹果Q", accountInfo.getRegional())) {
                params.put("game_id", "4868");
                params.put("f1", "苹果");
            }
            if (Objects.equals("苹果WX", accountInfo.getRegional())) {
                params.put("game_id", "4873");
                params.put("f1", "苹果");
            }


            params.put("f2", "我是号主");
            params.put("f3", "无防沉迷");
            params.put("f5", "0");
            params.put("f6", "0");
            params.put("f7", "");
            params.put("f8", "");
            params.put("f9", "");
            params.put("f10", "");
            params.put("f11", "");
            params.put("f12", "");
            params.put("f13", "");
            params.put("f14", "");
            params.put("f15", "");
            params.put("f16", "");
            params.put("f17", "");
            params.put("f18", "");
            params.put("f19", "");
            params.put("f20", "");
        }
        if (Objects.equals("CF端游", accountInfo.getType())) {

//            params.put("delivery_type", "g.delivery_type=1");

            params.put("bright_spot", "");
            params.put("type", "29");

            if (Objects.equals("北部大区", accountInfo.getRegional())) {
                params.put("game_id", "95474");

            }
            if (Objects.equals("南部大区", accountInfo.getRegional())) {
                params.put("game_id", "95473");
            }
            if (Objects.equals("西部大区", accountInfo.getRegional())) {
                params.put("game_id", "95472");
            }
            if (Objects.equals("东部大区", accountInfo.getRegional())) {
                params.put("game_id", "95471");
            }

            params.put("f1", "原号主");
            params.put("f2", "无");
            if (Arrays.asList(LCConstant.haveTwoList).contains(accountInfo.getLevel())){
                params.put("f3", "是");
            }else {
                params.put("f3", "无");
            }

            params.put("f5", "");
            params.put("f6", "");
            params.put("f7", "");
            params.put("f8", "");
            params.put("f9", "");
            params.put("f10", "");
            params.put("f11", "");
            params.put("f12", "");
            params.put("f13", "");
            params.put("f14", "");
            params.put("f15", "");
            params.put("f16", "");
            params.put("f17", "");
            params.put("f18", "");
            params.put("f19", "");
            params.put("f20", "");
        }
        if (Objects.equals("原神", accountInfo.getType())) {

            params.put("bright_spot", "");
            params.put("type", "385");

            params.put("game_id", "92461");
            params.put("f1", "手机账号");

            if ("邮箱可换绑".equals(accountInfo.getLevel())){
                params.put("f2", "带邮箱出售");
            }
            if ("未绑定邮箱".equals(accountInfo.getLevel())){
                params.put("f2", "不出售邮箱");
            }


            params.put("f3", "1");
            params.put("f4", "1");
            params.put("f5", "1");
            params.put("f6", "0");
            params.put("f7", "");
            params.put("f8", "");
            params.put("f9", "");
            params.put("f10", "是");
            params.put("f11", "否");
            params.put("f12", "是");
            params.put("f13", "");
            params.put("f14", "");
            params.put("f15", "");
            params.put("f16", "");
            params.put("f17", "");
            params.put("f18", "");
            params.put("f19", "");
            params.put("f20", "");
        }
        if (Objects.equals("逆战", accountInfo.getType())) {

            params.put("bright_spot", "");
            params.put("type", "211");

            if (Objects.equals("网通", accountInfo.getRegional())) {
                params.put("game_id", "39281");
            }
            if (Objects.equals("电信", accountInfo.getRegional())) {
                params.put("game_id", "39279");
            }
            params.put("f1", "QQ等级0级");

            params.put("f2", "有QQ好友");

            params.put("f3", "10");
            params.put("f4", "");
            params.put("f5", "");
            params.put("f6", "0");
            params.put("f7", "");
            params.put("f8", "");
            params.put("f9", "");
            params.put("f10", "");
            params.put("f11", "");
            params.put("f12", "");
            params.put("f13", "");
            params.put("f14", "");
            params.put("f15", "");
            params.put("f16", "");
            params.put("f17", "");
            params.put("f18", "");
            params.put("f19", "");
            params.put("f20", "");
        }
        if (Objects.equals("英雄联盟", accountInfo.getType())) {

            params.put("delivery_type", "g.delivery_type=0");

            params.put("type", "401");

            if (Objects.equals("峡谷之巅", accountInfo.getRegional())) {
                params.put("game_id", "93382");
            }
            if (Objects.equals("男爵领域", accountInfo.getRegional())) {
                params.put("game_id", "93381");
            }
            if (Objects.equals("试炼之地", accountInfo.getRegional())) {
                params.put("game_id", "93379");
            }
            if (Objects.equals("巨龙之巢", accountInfo.getRegional())) {
                params.put("game_id", "93377");
            }
            if (Objects.equals("扭曲丛林", accountInfo.getRegional())) {
                params.put("game_id", "93376");
            }
            if (Objects.equals("恕瑞玛", accountInfo.getRegional())) {
                params.put("game_id", "93375");
            }
            if (Objects.equals("无畏先锋", accountInfo.getRegional())) {
                params.put("game_id", "93374");
            }
            if (Objects.equals("弗雷尔卓德", accountInfo.getRegional())) {
                params.put("game_id", "93373");
            }
            if (Objects.equals("德玛西亚", accountInfo.getRegional())) {
                params.put("game_id", "93372");
            }
            if (Objects.equals("比尔吉沃特", accountInfo.getRegional())) {
                params.put("game_id", "93371");
            }
            if (Objects.equals("皮城警备", accountInfo.getRegional())) {
                params.put("game_id", "93369");
            }
            if (Objects.equals("卡拉曼达", accountInfo.getRegional())) {
                params.put("game_id", "93368");
            }
            if (Objects.equals("征服之海", accountInfo.getRegional())) {
                params.put("game_id", "93367");
            }
            if (Objects.equals("守望之海", accountInfo.getRegional())) {
                params.put("game_id", "93366");
            }
            if (Objects.equals("影流", accountInfo.getRegional())) {
                params.put("game_id", "93365");
            }
            if (Objects.equals("教育网专区", accountInfo.getRegional())) {
                params.put("game_id", "93364");
            }
            if (Objects.equals("水晶之痕", accountInfo.getRegional())) {
                params.put("game_id", "93363");
            }
            if (Objects.equals("均衡教派", accountInfo.getRegional())) {
                params.put("game_id", "93362");
            }
            if (Objects.equals("钢铁烈阳", accountInfo.getRegional())) {
                params.put("game_id", "93361");
            }
            if (Objects.equals("暗影岛", accountInfo.getRegional())) {
                params.put("game_id", "93360");
            }
            if (Objects.equals("黑色玫瑰", accountInfo.getRegional())) {
                params.put("game_id", "93359");
            }
            if (Objects.equals("裁决之地", accountInfo.getRegional())) {
                params.put("game_id", "93358");
            }
            if (Objects.equals("雷瑟守备", accountInfo.getRegional())) {
                params.put("game_id", "93357");
            }
            if (Objects.equals("巨神峰", accountInfo.getRegional())) {
                params.put("game_id", "93356");
            }
            if (Objects.equals("战争学院", accountInfo.getRegional())) {
                params.put("game_id", "93355");
            }
            if (Objects.equals("皮尔特沃夫", accountInfo.getRegional())) {
                params.put("game_id", "93354");
            }
            if (Objects.equals("班德尔城", accountInfo.getRegional())) {
                params.put("game_id", "93353");
            }
            if (Objects.equals("诺克萨斯", accountInfo.getRegional())) {
                params.put("game_id", "93352");
            }
            if (Objects.equals("祖安", accountInfo.getRegional())) {
                params.put("game_id", "93351");
            }
            if (Objects.equals("艾欧尼亚", accountInfo.getRegional())) {
                params.put("game_id", "93350");
            }
            params.put("f1", "当前赛季无排位");

            params.put("f2", "当前赛季无排位");

            params.put("f3", "当前赛季无排位");
            params.put("f4", "1");
            params.put("f5", accountInfo.getHeroes());
            params.put("f6", accountInfo.getSkins());
            params.put("f7", "原号主");
            params.put("f8", "无防沉迷");
            if (Arrays.asList(LCConstant.haveTwoList).contains(accountInfo.getLevel())){
                params.put("f9", "是");
            }else {
                params.put("f9", "否");
            }

            params.put("f10", "");
            params.put("f11", "");
            params.put("f12", "");
            params.put("f13", "");
            params.put("f14", "");
            params.put("f15", "");
            params.put("f16", "");
            params.put("f17", "");
            params.put("f18", "");
            params.put("f19", "");
            params.put("f20", "");
        }
        if (Objects.equals("和平精英", accountInfo.getType())) {

            params.put("bright_spot", accountInfo.getLevel() + "|枪皮数量 " + accountInfo.getGuns() + "|套装数量 " + accountInfo.getSuit());

            params.put("f3", "0");
            params.put("f4", "");
            params.put("f5", accountInfo.getSuit());
            params.put("f6", accountInfo.getGuns());
            params.put("f7", "详情看图");

            if (Objects.equals("安卓Q", accountInfo.getRegional())) {
                params.put("game_id", "23403");
            }
            if (Objects.equals("安卓WX", accountInfo.getRegional())) {
                params.put("game_id", "23406");
            }
            if (Objects.equals("苹果Q", accountInfo.getRegional())) {
                params.put("game_id", "23409");
            }
            if (Objects.equals("苹果WX", accountInfo.getRegional())) {
                params.put("game_id", "23412");
            }

            params.put("type", "98");
            params.put("f7", accountInfo.getSkins());
            params.put("f8", "");
            params.put("f9", "");
            params.put("f10", "");
            params.put("f11", "");
            params.put("f12", "");
            params.put("f13", "");
            params.put("f14", "");
            params.put("f15", "");
            params.put("f16", "");
            params.put("f17", "");
            params.put("f18", "");
            params.put("f19", "");
            params.put("f20", "");


            params.put("account_fields", "{\n" +
                    "        \"0\": \"11\",\n" +
                    "        \"1\": \"11\",\n" +
                    "        \"2\": \"11\"\n" +
                    "    }");


            if (Arrays.asList(LCConstant.haveTwoList).contains(accountInfo.getLevel())) {
                params.put("f11", "是");
            } else {
                params.put("f11", "无");
            }
        }

        params.put("mobile", "17120401234");
        params.put("qq", "111");
        params.put("wechat", "111");

        return params;
    }


    private Map<String, String> getHeader(SalePartner salePartner) {


        /**
         * XX-Token  9518d5daf5c7353d0895d2febc2815e79f3a2add4422aef74a893434ed2ffa6d
         * XX-Device-Type  pc
         * XX-App  trading
         * XX-Subsite  0
         */

        Object tokenJiuai = redisCache.getCacheObject(salePartner.getTwoOther());
        Map<String, String> header = new HashMap<>();
        if (Objects.nonNull(tokenJiuai)){

            header.put("XX-Token", tokenJiuai.toString());
            header.put("XX-Device-Type", "pc");
            header.put("XX-App", "trading");
            header.put("XX-Subsite", "0");
            header.put("Content-Type", "application/json");
        }



        return header;
    }

    @Override
    public AjaxResult delGame(Long id, Long userId, SalePartner sa) {

//        https://api2.shaobodaishou.com/api/goods/UserGoods/setStatus0
//        id
//        :
//        6719

        String path = "/api/goods/UserGoods/setStatus0";

        Map<String, Object> params = new TreeMap<>();

        AccountInfo accountInfo = accountInfoMapper.selectAccountInfoById(id);
        params.put("id", accountInfo.getSboid());
        Map<String, Object> result = new HashMap<>();
        log.info("少伯下架接口请求参数={}", JSONObject.toJSONString(params));
        String response = "";
        try {
            response = HttpUtils.sendPost(OutUrlConstant.SBO + path, JSONObject.toJSONString(params), getHeader(sa));
        } catch (IOException e) {
            throw new GlobalException("接口异常");
        }
        if (StringUtils.isEmpty(response)) {
            throw new GlobalException("请求接口失败");
        }
        log.info("少伯下架接口返回参数={}", JSONObject.toJSONString(response));
        JSONObject resultJson = JSONObject.parseObject(response);
        if (!"1".equals(resultJson.getString("code"))) {
            result.put("code", 500);
        } else {
            result.put("code", 200);
        }

        result.put("req", JSONObject.toJSONString(params));
        result.put("res", response);
        result.put("msg", resultJson.getString("msg"));
        return AjaxResult.success(result);
    }


    public static void main(String[] args) {

        /**
         * XX-Token  9518d5daf5c7353d0895d2febc2815e79f3a2add4422aef74a893434ed2ffa6d
         * XX-Device-Type  pc
         * XX-App  trading
         * XX-Subsite  0
         */

        String username = "18924248888";
        String password = "aa515154";
        String device_type = "pc";

        String url = "https://api2.shaobodaishou.com/api/user/public/login";

        Map<String, Object> params = new HashMap<>();
        params.put("username", username);
        params.put("password", password);
        params.put("device_type", device_type);

        String response = HttpUtils.sendPost(url, JSONObject.toJSONString(params), "application/json");
        System.out.println(response);


    }

}
